package com.cn.pool1;

import java.net.InetSocketAddress;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import com.alibaba.fastjson.JSON;

import db.User;



public class Start {

	public static void main(String[] args) {
		//初始化线程池
		NioSelectorRunnablePool nioSelectorRunnablePool = new NioSelectorRunnablePool(Executors.newCachedThreadPool(),Executors.newCachedThreadPool());
		//获取服务类
		ServerBootstrap bootstrap = new ServerBootstrap(nioSelectorRunnablePool);
		//绑定端口
		bootstrap.bind(new InetSocketAddress(8888));
		System.out.println("服务器启动！");
		
		/*MssageUtil<User> mssageUtil = new MssageUtil<User>();
		mssageUtil.getTyep().put("tp","add");
		//mssageUtil.getTyep().put("pm","1");
		
		User user = new User();
		user.setUsername("xiaomin");
		user.setPassword("12365");
		mssageUtil.getList().add(user);*/
		//{"list":[],"tyep":{"tp":"find"}}
		
		
		//String a = "{\"list\":[{\"id\":0,\"password\":\"12365\",\"username\":\"xiaomin\"}],\"tyep\":{\"tp\":\"add\"}}";
		//MssageUtil<User> mssageUtil =  (MssageUtil<User>) JSON.parseObject(a,MssageUtil.class);
		//{\"list\":[{\"id\":0,\"password\":\"12365\",\"username\":\"xiaomin\"}],\"tyep\":{\"tp\":\"add\"}},{\"list\":[],\"tyep\":{\"tp\":\"find\",\"pm\":\"1\"}}
		//System.out.println(JSON.toJSONString(mssageUtil));
	}

}
